package com.example.controller;

import com.example.common.Result;
import com.example.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 新增
     */
    @GetMapping("/redis")
    public String redis(@RequestParam(value = "key") String key,@RequestParam(value = "val") String val) {
        redisTemplate.opsForValue().set(key, val);
        String back = (String) redisTemplate.opsForValue().get(key);
        return back;

    }
}
